package cn.edu.hqu.cst.chapter0204.domain;

import lombok.Data;
//import lombok.RequiredArgsConstructor;

@Data
//@RequiredArgsConstructor
public class Ingredient {
    private final String id;
    private final String name;
    private final Ingredient.Type type;

    public String getId() {
        return this.id;
    }

    public String getName() {
        return this.name;
    }

    public Ingredient.Type getType() {
        return this.type;
    }

    public boolean equals(Object o) {
        if (o == this) {
            return true;
        } else if (!(o instanceof Ingredient)) {
            return false;
        } else {
            Ingredient other = (Ingredient) o;
            if (!other.canEqual(this)) {
                return false;
            } else {
                label47:
                {
                    Object this$id = this.getId();
                    Object other$id = other.getId();
                    if (this$id == null) {
                        if (other$id == null) {
                            break label47;
                        }
                    } else if (this$id.equals(other$id)) {
                        break label47;
                    }

                    return false;
                }

                Object this$name = this.getName();
                Object other$name = other.getName();
                if (this$name == null) {
                    if (other$name != null) {
                        return false;
                    }
                } else if (!this$name.equals(other$name)) {
                    return false;
                }

                Object this$type = this.getType();
                Object other$type = other.getType();
                if (this$type == null) {
                    if (other$type != null) {
                        return false;
                    }
                } else if (!this$type.equals(other$type)) {
                    return false;
                }

                return true;
            }
        }
    }

    protected boolean canEqual(Object other) {
        return other instanceof Ingredient;
    }

    public int hashCode() {
        boolean PRIME = true;
        int result = 1;
        Object $id = this.getId();
        result = result * 59 + ($id == null ? 43 : $id.hashCode());
        Object $name = this.getName();
        result = result * 59 + ($name == null ? 43 : $name.hashCode());
        Object $type = this.getType();
        result = result * 59 + ($type == null ? 43 : $type.hashCode());
        return result;
    }

    public String toString() {
        return "Ingredient(id=" + this.getId() + ", name=" + this.getName() + ", type=" + this.getType() + ")";
    }

    public Ingredient(String id, String name, Ingredient.Type type) {
        this.id = id;
        this.name = name;
        this.type = type;
    }

    public static enum Type {
        CLASS1,
        CLASS2,
        CLASS3,
        CLASS4,
        CLASS5;

        private Type() {
        }
    }

}
